<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<?php
echo "欢迎<br>";
//获取user输入框和pass输入框的数据
$str_name = $_GET["username"];
$str_pass = $_GET["password"];
try{
    $pdo = new PDO("mysql:dbname=liu;host=127.0.0.1","root","");
    $pdo->exec("SET NAMES 'utf8'");
    $sql = "INSERT INTO log_user (`log_name`,`log_pass`) VALUES('$str_name','$str_pass');";
    $res = $pdo->exec($sql);
}catch (PDOException $e){
    echo "错误信息：".$e->getMessage();
}
if($res > 0){
    echo "登录成功<br>";
}else{
    echo "登录失败<br>";
}
echo "<table>";
foreach ($res as $v){
    echo "<tr>
        <td>{$v['log_id']}</td>
        <td>{$v['log_name']}</td>
        <td>{$v['log_pass']}</td>
        <td>{$v['log_age']}</td>
    </tr>";
}
echo "</table>";